﻿//************************************************************ 
// Copyright © 2009 - 2010 Oleg Stuhin & Rostislav Haitovich
// To learn more about Mytrip.Mvc.Entyty visit 
// http://starterkitmytripmvc.codeplex.com/
// mytripmvc@gmail.com
// license: Microsoft Public License (Ms-PL) 
// ***********************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace Mytrip.Theme
{
    /// <summary>
    /// Theme Setting
    /// </summary>
    public static class ThemeSetting
    {
        /// <summary>
        /// Default Theme
        /// </summary>
        public static string defaultTheme = ConfigurationManager.AppSettings["defaultTheme"];
        /// <summary>
        /// All Theme
        /// </summary>
        public static string allTheme = ConfigurationManager.AppSettings["allTheme"];
        /// <summary>
        /// Unlock Theme
        /// </summary>
        public static bool unlockTheme = bool.Parse(ConfigurationManager.AppSettings["unlockTheme"]);
        /// <summary>
        /// All Theme Massive
        /// </summary>
        public static string[] allThemeMassive = allTheme.Split(',');
        /// <summary>
        /// Brouser
        /// </summary>
        public static string brouser = HttpContext.Current.Request.Browser.Browser;
        /// <summary>
        /// Major Version
        /// </summary>
        public static int majorversion = HttpContext.Current.Request.Browser.MajorVersion;
        /// <summary>
        /// Minor Version
        /// </summary>
        public static double minorversion = HttpContext.Current.Request.Browser.MinorVersion;
        /// <summary>
        /// Version
        /// </summary>
        public static string version = HttpContext.Current.Request.Browser.Version;
        /// <summary>
        /// Theme
        /// </summary>
        /// <returns></returns>
        public static string theme()
        {
            string theme=ThemeSetting.defaultTheme;
            if (HttpContext.Current.Session["theme"] != null)
                theme = HttpContext.Current.Session["theme"].ToString();
            if (HttpContext.Current.Request.Cookies["myTripTheme"] != null)
                theme = HttpContext.Current.Request.Cookies["myTripTheme"].Value;
            return theme;
        }
    }
}